﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Meraz.Core.Model
{
    public class Issue
    {
        public Issue() { Attributes = new List<Attribute>(); }
        public int ID { get; set; }
        public int PostID { get; set; }
        public int TopicID { get; set; }
        public string AffectiveFrame 
        {
            get { return this.AffectiveFrameType.ToString(); }
            set {
                if (string.IsNullOrWhiteSpace(value))
                {
                    this.AffectiveFrameType = AffectiveFrameType.Undefined;
                }
                else
                {
                    try
                    {
                        this.AffectiveFrameType = (AffectiveFrameType)Enum.Parse(typeof(AffectiveFrameType), value);
                    }
                    catch
                    {
                        this.AffectiveFrameType = AffectiveFrameType.Undefined;
                    }
                }
            }
        }
        public AffectiveFrameType AffectiveFrameType { get; set; }
        public List<Attribute> Attributes { get; set; }
        public Post Post { get; set; }
        public virtual Topic Topic { get; set; }
    }
}
